package com.example.day02.model;

import com.example.day02.base.BaseModel;
import com.example.day02.base.BaseObserver;
import com.example.day02.bean.FuLiBean;
import com.example.day02.not.ApiService;
import com.example.day02.not.HttpUlist;
import com.example.day02.not.RxUlist;

import io.reactivex.Observable;

public class FuLiModel extends BaseModel {
    public void modeldata(FuLICallBack callBack){
        ApiService apiserver = new HttpUlist().getApiserver(ApiService.url, ApiService.class);
        Observable<FuLiBean> getdata = apiserver.getdata();
        getdata.compose(RxUlist.ReobservableTransformer())
                .subscribe(new BaseObserver<FuLiBean>(this) {
                    @Override
                    protected void onSuccess(FuLiBean fuLiBean) {
                        callBack.onSuccess(fuLiBean);
                    }

                    @Override
                    protected void onFali(String message) {
                        callBack.onFali(message);
                    }
                });
    }
}
